#ifndef MUTALINE_H
#define MUTALINE_H

#include <MutaObject.h>
#include <QGraphicsPathItem>
#include <QPointF>
#include <QList>
#include <QPointer>
//#include <QGraphicsEllipseItem>
#include "ControlPoint.h"
#include <QGraphicsSceneMouseEvent>
#include <QElapsedTimer>


class MutaLine : public MutaObject,public QGraphicsPathItem
{
    Q_OBJECT
public:
    MutaLine(QString objectID,QString owner,QPointF p1,QPointF p2,int layer);
    MutaLine(QString objectID,QString owner,QPointF p1,QPointF p2,int layer,int zero);
    virtual void setPos(const QPointF &pos);
    void setFinalPoint(QPointF p);
    void addControlPoint(QPointF p);
    void addControlPointNQ(QPointF p);
    void setPoint(int num, QPointF p);
    int getLayer();
    QStringList getProperties();
    int type() const;
    virtual void forceOSCthulhuUpdate();
    void setControlPoints(QString controlPointString);
    void setCurvePoint(int num, QPointF point);

protected:
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
    QVariant itemChange(GraphicsItemChange change, const QVariant &value);

private:
    QList<ControlPoint*> controlPoints;
    QList<ControlPoint*> curvePoints;
    void buildPath();
    void setColor();
    int time;
    QColor boxColor;
    QBrush boxBrush;
    QPen boxPen;
    int layer;
    void buildControlPointString();
    QString controlPointString;


signals:
    void ellipseAdded(QGraphicsItem* ellipse);
    void controlPointAdded(QString objectID,QString controlPointString);

public slots:
    void cPointMoved(QPointF pos,int num);
    void curvePointMoved(QPointF pos,int num);
};

#endif // MUTALINE_H
